

//Program which recursively walks through the javacc tree object and extracts details

package opennlp.ccg.parsecat;


import java.util.*;
//import org.jdom.*;
//import org.jdom.output.*;

public class WalkTree{
	
	public void eval(SimpleNode node)throws Exception{
		
		//No:of children of any given node
		int numC=node.jjtGetNumChildren();
		
		//Loop & flag variables
		int i=0;int flag=2;
		SimpleNode child;
		System.out.println(node.print());

		//Processing the child nodes of the current node.
		for(i=0;i<numC;i++){
			
			child=(SimpleNode)node.jjtGetChild(i);
			eval(child);
					
					
		}

	}
			
	public void rootEval(SimpleNode node)throws Exception{

		int numC=node.jjtGetNumChildren();
		
		//Loop & flag variables
		int i=0;int flag=2;
		SimpleNode child;
		

		//Processing the child nodes of the current node.
		for(i=0;i<numC;i++){
			
			child=(SimpleNode)node.jjtGetChild(i);
			System.out.println(child.print());
					
					
		}
			

			

	}
		
			
}
		


